package com.healthshare.busi.share;

import com.healthshare.parse.RetCodeParse;
import com.palmedia.framework.business.BaseBusi;
import com.palmedia.framework.myinterface.UiCallBack;
import com.palmedia.framework.parse.BaseParse;
/**
 * @author xudeliang
 * 分享
 */
public class ShareBusi extends BaseBusi
{

	//请求路径：share/share?channeltype=0&public=0
	private  String  tail = "share/share.php?";
	
	
	public String channeltype = "0";
	
	/*该字段只有健康问答才能使用，0表示不
	 * 公开给其他用户看，1表示公开给其他用户看。*/
	public int ipublic = 0;
	
	public String  content;//	二进制	分享内容（post）utf-8
	public byte[] picData;//Picdata	二进制	图片数据（post）

	
	public ShareBusi(UiCallBack bCallBack)
	{
		super(bCallBack);
	}
	
	public void iExecute()
    {
		reqParam = tail+"channeltype="+channeltype+"&public="+ipublic;
		
		String tmpdata = "content="+content+"&picdata=";
		if(picData!=null)
		{
			buffer = new byte[tmpdata.getBytes().length+picData.length];
	
			System.arraycopy(tmpdata.getBytes(), 0, buffer, 0, tmpdata.getBytes().length);
			
			System.arraycopy(picData, 0, buffer, tmpdata.getBytes().length, picData.length);
		}
		else
		{
			buffer = tmpdata.getBytes();
		}
    	super.iExecute();
    }
	
	@Override
	protected BaseParse parseResult(byte[] data)
	{
		RetCodeParse	ls = new RetCodeParse();
		ls.Parse(data);
		return ls;
	}
	
	
	
}
